# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(protobuf_core)
SET(CMAKE_CXX_STANDARD 17)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()
set(protobuf_BUILD_TESTS OFF)
set(protobuf_WITH_ZLIB OFF)

set(PROTOBUF_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../third_party/protobuf")
add_subdirectory(${PROTOBUF_SRC_DIR} ${CMAKE_BINARY_DIR}/protobuf)

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include)

add_library(turbotransprotobuf SHARED napi_init.cpp include/protobuf_util.h include/protobuf_util.h src/protouf_util.cpp src/turbo_trans_protobuf_util.cpp src/napi_util.cpp include/napi_util.h include/logger.h src/logger.cpp)
target_link_libraries(turbotransprotobuf PRIVATE
                      protobuf::libprotobuf
                      protobuf::libprotoc)
target_link_libraries(turbotransprotobuf PUBLIC libace_napi.z.so libhilog_ndk.z.so libhitrace_ndk.z.so)
target_include_directories(turbotransprotobuf PRIVATE ${GENERATED_DIR})
